package kr.ragne.letsparis;

import kr.ragne.framework.AppManager;
import kr.ragne.framework.GraphicObject;
import kr.ragne.letsparitime.R;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.Log;

public class BackGround extends GraphicObject {
	static final float SCROLL_SPEED = 5.0f;
	public static int SCREEN_WIDTH = 480;
	private float scroll = -2000 + 480;
	private float scroll2 = -4000 + 480;
	Bitmap back2;
	public static int backtype = 0;

	public BackGround() {
		super(null);
		bitmap = AppManager.getInstance().getBitmap(R.drawable.background1);
		back2 = AppManager.getInstance().getBitmap(R.drawable.background2);
	}

	void Update() {
		scroll = scroll + SCROLL_SPEED;
		scroll2 = scroll2 +SCROLL_SPEED;
		if(scroll >= 480){
			Log.d("back", "scroll");
			scroll = -4000 + 480;
		}
		if(scroll2 >= 480){
			Log.d("back", "scroll2");
			scroll2 = -4000 + 480;
		}
			
			
	}

	@Override
	public void Draw(Canvas canvas) {
		if (canvas != null) {
			float screenX = canvas.getWidth();
			float screenY = canvas.getHeight();

			float scaleX = screenX / 480f;
			float scaleY = screenY / 320f;
			canvas.scale(scaleX, scaleY);
			canvas.drawBitmap(bitmap, scroll, 0, null);
			canvas.drawBitmap(back2, scroll2, 0, null);
		}
	}

}
